1 Public Class FrmCATEGORYSELECTitem
2 Private Sub cmdCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCancel.Click
3 Me.Close()
4 End Sub
5
6 Private Sub FrmCATEGORYSELECTitem_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
7 txtsearch.Focus()
8 txtsearch.Text = ""
9 lstItems.Items.Clear()
10 FILLComboBox("SELECT Catg_ID, Catg_Name FROM tbl_Category_File ORDER BY tbl_Category_File.Catg_Name ASC ", cmbCategory)
11 End Sub
12
13 Private Sub cmbCategory_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbCategory.SelectedIndexChanged
14 'MsgBox(cmbCategory.Left)
15 FillListView(ExecuteSQLQuery("SELECT Item_ID as 'Item ID', Replace(Replace(Item_Name,'$.$',''''),'$..$',',') as 'Name' FROM tbl_Category_Item_File WHERE Catg_ID =" & Split(cmbCategory.Text, " - ")(0)), lstItems, 1)
16 End Sub
17
18 Private Sub cmdSelect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSelect.Click
19 Dim i As Integer, x As Integer
20 'If cmbCategory.Text = "" Then
21 ' MsgBox("No category selected !!", MsgBoxStyle.Information, "Sales and Inventory")
22 ' Exit Sub
23 ' End If
24 'With FrmADDSUPPLIER_ITEM
25 ' If lstItems.Items.Count > 0 Then
26 ' lstItems.Focus()
27 ' .txtcategory.Text = Split(cmbCategory.Text, " - ")(0)
28 ' .txtid.Text = lstItems.FocusedItem.Text
29 ' .txtname.Text = lstItems.FocusedItem.SubItems(1).Text
30 ' .txtprice.Text = lstItems.FocusedItem.SubItems(2).Text
31 ' End If
32 ' Me.Close()
33 ' End With
34 If lstItems.Items.Count > 0 Then
35 lstItems.Focus()
36 With FrmAddSupplier.lstProducts
37 For i = 0 To .Items.Count - 1
38 'MsgBox(lstItems.FocusedItem.SubItems(1).Text)
39 If .Items(i).SubItems(1).Text = lstItems.FocusedItem.SubItems(1).Text Then
40 MsgBox("Current details is on the list !!", MsgBoxStyle.Information, "Sales and Inventory")
41 Exit Sub
42 End If
43 Next
44
45 For i = 0 To lstItems.Items.Count - 1
46 If lstItems.Items(i).Selected Then
47 '.Items.Add(Split(cmbCategory.Text, " - ")(0))
48 .Items.Add(lstItems.Items(i).Text)
49 For x = 0 To .Items.Count - 1
50 .Items(x).SubItems.Add(lstItems.Items(i).SubItems(1).Text)
51 .Items(x).SubItems.Add(lstItems.Items(i).SubItems(2).Text)
52 Next
53
54 End If
55 Next
56 End With
57 End If
58
59 Me.Close()
60 End Sub
61
62 Private Sub txtsearch_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtsearch.TextChanged
63 'FillListView(ExecuteSQLQuery("SELECT Item_ID as 'Item ID', Replace(Replace(Item_Name,'$.$',''''),'$..$',',') as 'Name' FROM tbl_Category_Item_File WHERE Catg_ID =" & Split(cmbCategory.Text, " - ")(0)), lstItems, 1)
64 lstItems.Items.Clear()
65 If Len(txtsearch.Text) > 0 Then
66 sqlSTR = "SELECT * FROM tbl_Category_Item_File WHERE Item_Name LIKE '%" & R_eplace(txtsearch.Text) & "%' ORDER BY Item_Name"
67 ExecuteSQLQuery(sqlSTR)
68 If sqlDT.Rows.Count > 0 Then
69 With lstItems
70 For i = 0 To sqlDT.Rows.Count - 1
71 .Items.Add(sqlDT.Rows(i)("Catg_ID"), 0)
72 .Items((.Items.Count - 1)).SubItems.Add(R_Change(sqlDT.Rows(i)("Item_ID")))
73 .Items((.Items.Count - 1)).SubItems.Add(R_Change(sqlDT.Rows(i)("Item_Name")))
74 '.Items((.Items.Count - 1)).SubItems.Add(txtprice.Text)
75 '.Items((.Items.Count - 1)).SubItems.Add(txtqty.Text)
76 Next
77 End With
78
79 End If
80 End If
81 End Sub
82 End Class